package com.scatteredServer.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.scatteredServer.common.Result;
import com.scatteredServer.pojo.entity.Feedback;
import com.scatteredServer.pojo.query.FeedbackQuery;
import com.scatteredServer.pojo.vo.BaseVo;
import com.scatteredServer.pojo.vo.FeedbackVo;
import com.scatteredServer.pojo.vo.PostingRoughlyVo;
import com.scatteredServer.service.FeedbackService;
import com.scatteredServer.mapper.FeedbackMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author admin
* @description 针对表【feedback(意见反馈表)】的数据库操作Service实现
* @createDate 2024-04-05 14:12:12
*/
@Service
public class FeedbackServiceImpl extends ServiceImpl<FeedbackMapper, Feedback>
    implements FeedbackService{

    @Autowired
    FeedbackMapper feedbackMapper;

    @Override
    public Result<BaseVo<FeedbackVo>> getList(FeedbackQuery feedbackQuery) {
        Page<FeedbackVo> page = new Page<>(feedbackQuery.getCurrentPage(), feedbackQuery.getPageSize());
        Page<FeedbackVo> result = feedbackMapper.getList(page, feedbackQuery);

        BaseVo<FeedbackVo> criteriaBaseVo = new BaseVo<>();
        criteriaBaseVo.setCurrentPage(feedbackQuery.getCurrentPage());
        criteriaBaseVo.setPageSize(feedbackQuery.getPageSize());
        criteriaBaseVo.setAllPages(result.getPages());
        criteriaBaseVo.setAllRecordNum(result.getTotal());
        criteriaBaseVo.setRecords(result.getRecords());

        return Result.success(criteriaBaseVo);
    }
}




